var xhrTimeout;

var RequestObject = false; // XMLHttpRequest Object
// var Backend =
// '<%=response.encodeURL("http://www.mh.gob.sv/renta/consrenta")%>'; // Backend
// url
// var Backend = 'http://mt1.mh.gob.sv:7777/testrenta/consrenta'; // Backend url
// var Backend = 'http://localhost:8080/ssc/pi/renta/query';
// alert (Backend);

//
try {
    RequestObject = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
    try {
        RequestObject = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
        RequestObject = false;
    }
}

if (!RequestObject && typeof XMLHttpRequest != 'undefined') {
    RequestObject = new XMLHttpRequest();
}


function submitenter(myfield, e) {
    var keycode;
    if (window.event)
        keycode = window.event.keyCode;
    else if (e)
        keycode = e.which;
    else
        return true;

    if (keycode == 13) {
        AJAXRequest();
        return false;
    } else
        return true;
}


function submitenter2(myfield, e) {
    var keycode;
    if (window.event)
        keycode = window.event.keyCode;
    else if (e)
        keycode = e.which;
    else
        return true;

    if (keycode == 13 && document.formaconsulta.boton.disabled == false) {
        AJAXRequest();
        return false;
    } else
        return true;
}

function otraconsulta() {

    if (document.getElementById("box")) {
        document.getElementById("box").innerHTML = '';
    }
    document.getElementById("link").innerHTML = '';
    document.getElementById("online").innerHTML = '';
    if (document.formaconsulta.nit) {
        document.formaconsulta.nit.value = '';
    }

    reloadImg('img');

    document.formaconsulta.jcaptcha.value = '';

    document.formaconsulta.periodo.value = '';
    document.formaconsulta.periodo.focus();
    document.formaconsulta.boton.disabled = false;
    // return false;

}


function ReqChange() {
    //alert('Entrando a ReqChange ' + RequestObject.readyState);
    // If data received correctly
    if (RequestObject.readyState == 4) {
         //alert(RequestObject.getAllResponseHeaders());
        // if data is valid
        clearTimeout(xhrTimeout);
        if (RequestObject.status == 200) {
            // cambios 07/03/2008
            // clearTimeout(xhrTimeout);
            // getting the response
            var msgs = RequestObject.responseText.split('|');
//            alert(RequestObject.responseText);
            document.getElementById("online").innerHTML = msgs[0];
            // document.formaconsulta.boton.disabled=false;

        } else {
//            alert('Status ' + RequestObject.status);
            var msgs = RequestObject.responseText.split('|');
//            alert(RequestObject.responseText);
            document.getElementById("online").innerHTML = msgs[0];
            // Tell the reader that there was error requesting data
            document.getElementById("online").innerHTML = "<div id='box'><center>No pudo ser procesada su solicitud en este momento, favor intente otro momento</center></div>";
        }

        // document.formaconsulta.boton.disabled=false;
        if (document.formaconsulta.nit) {
            document.formaconsulta.nit.value = '';
        }
        document.formaconsulta.periodo.value = '';
    }

}

function AJAXRequest() {
    var captado = document.formaconsulta.jcaptcha.value;

    if (captado.length == 0) {
        alert("Debe de ingresar la palabra que aparece en la imagen.");
        document.formaconsulta.jcaptcha.focus();
        reloadImg('img');
        return false;
    }

    if (validarPeriodo()) {
        document.getElementById("online").innerHTML = "<CENTER><IMG src=images/loading.gif> <BR><FONT color=\"#136DB9\"> Espere un momento mientras procesamos su solicitud</FONT></CENTER> ";                
        document.formaconsulta.boton.disabled = true;
        RequestObject.open("POST", Backend, true);
        xhrTimeout = setTimeout("ajaxTimeout();", 10000);
        RequestObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
        RequestObject.send(createQuery(document.getElementById("formaconsulta")));
        RequestObject.onreadystatechange = ReqChange;
    }

}



function validarPeriodo() {
    var p = document.formaconsulta.periodo.value;
    if (p.length <= 3 || p.length > 4) {
        alert("El Periodo Fiscal a consultar debe estar formado por cuatro digitos numericos");
        document.formaconsulta.periodo.focus();
        reloadImg('img');
        return false;
    }
    /*
     * Aqui se hara el cambio para que se agregue la consulta de renta 2010
     */

    var today = new Date();
    var year = today.getFullYear();

    if (p > year - 1) {
        alert("El Periodo Fiscal a consultar no puede ser mayor de "
                + (year - 1));
        document.formaconsulta.periodo.focus();
        reloadImg('img');
        return false;
    }

    if (p < 2003) {
        alert("El Periodo Fiscal a consultar debe ser mayor o igual a 2003");
        document.formaconsulta.periodo.focus();
        reloadImg('img');
        return false;
    }

    if (document.formaconsulta.nit) {
        var n = document.formaconsulta.nit.value;

        if (n.length <= 13 || n.length > 14) {
            alert("El NIT a consultar debe estar formado por catorce digitos numericos");
            document.formaconsulta.nit.focus();
            reloadImg('img');
            return false;
        }

        if (!isNumber(n)) {
            alert("Por favor ingrese solo numeros para el NIT");
            document.formaconsulta.nit.focus();
            reloadImg('img');
            return false;
        }
    }
    if (!isNumber(p)) {
        alert("Por favor ingrese solo numeros para el Periodo Fiscal");
        document.formaconsulta.periodo.focus();
        reloadImg('img');
        return false;
    }

    return true;
}

function reloadImg(id) {
    var obj = document.getElementById(id);
    var src = obj.src;
    var pos = src.indexOf('?');
    if (pos >= 0) {
        src = src.substr(0, pos);
    }
    var date = new Date();
    obj.src = src + '?v=' + date.getTime();
    document.formaconsulta.jcaptcha.value = '';
    return false;
}





function submitenter3(myfield, e) {
    var keycode;
    if (window.event)
        keycode = window.event.keyCode;
    else if (e)
        keycode = e.which;
    else
        return true;

    if (keycode == 13 && document.formaconsulta.boton.disabled == false) {
        AJAXRequest3();
        return false;
    } else
        return true;
}

function submitenterUACI(myfield, e) {
    var keycode;
    if (window.event)
        keycode = window.event.keyCode;
    else if (e)
        keycode = e.which;
    else
        return true;

    if (keycode == 13 && document.formaconsulta.boton.disabled == false) {
        AJAXRequest3();
        return false;
    } else
        return true;
}





function otraconsultaK() {

    if (document.getElementById("box")) {
        document.getElementById("box").innerHTML = '';
    }
    document.getElementById("link").innerHTML = '';
    document.getElementById("online").innerHTML = '';
    if (document.formaconsulta.nit) {
        document.formaconsulta.nit.value = '';
    }

    document.formaconsulta.periodo.value = '';
    document.formaconsulta.boton.disabled = false;
    // return false;

}

function otraconsulta2() {

    if (document.getElementById("box")) {
        document.getElementById("box").innerHTML = '';
    }
    document.getElementById("link").innerHTML = '';
    document.getElementById("online").innerHTML = '';
    if (document.formaconsulta.nit) {
        document.formaconsulta.nit.value = '';
        document.formaconsulta.nit.focus();
    } else {
        document.formaconsulta.periodo.focus();
    }

    document.formaconsulta.periodo.value = '';
    document.formaconsulta.monto.value = '';
    document.formaconsulta.boton.disabled = false;
    // return false;

}

function otraconsulta3() {

    if (document.getElementById("box")) {
        document.getElementById("box").innerHTML = '';
    }
    document.getElementById("link").innerHTML = '';
    document.getElementById("online").innerHTML = '';
    if (document.formaconsulta.nit) {
        document.formaconsulta.nit.value = '';
        document.formaconsulta.nit.focus();
    } else {
        // document.formaconsulta.periodo.focus();
        ;
    }

    // document.formaconsulta.periodo.value = '';
    // document.formaconsulta.monto.value = '';
    document.formaconsulta.boton.disabled = false;
    // return false;

}




function ReqChange2() {
    // alert('Entrando a ReqChange ' + RequestObject.readyState);

    // If data received correctly
    if (RequestObject.readyState == 4) {
        // alert(RequestObject.getAllResponseHeaders());
        // if data is valid
        clearTimeout(xhrTimeout);
        if (RequestObject.status == 200) {
            // cambios 07/03/2008
            // clearTimeout(xhrTimeout);
            // getting the response
            var msgs = RequestObject.responseText.split('|');
            // alert(RequestObject.responseText);
            document.getElementById("online").innerHTML = msgs[0];
            // document.formaconsulta.boton.disabled=false;

        } else {
            // alert('Status ' + RequestObject.status);
            var msgs = RequestObject.responseText.split('|');
            // alert(RequestObject.responseText);
            document.getElementById("online").innerHTML = msgs[0];
            // Tell the reader that there was error requesting data
            document.getElementById("online").innerHTML = "<div id='box'><center>No pudo ser procesada su solicitud en este momento, favor intente otro momento</center></div>";
        }

        // document.formaconsulta.boton.disabled=false;
        if (document.formaconsulta.nit) {
            document.formaconsulta.nit.value = '';
        }
        document.formaconsulta.periodo.value = '';
        document.formaconsulta.monto.value = '';
    }

}

// FPEMP
function ReqChange3() {
    // alert('Entrando a ReqChange ' + RequestObject.readyState);

    // If data received correctly
    if (RequestObject.readyState == 4) {
        // alert(RequestObject.getAllResponseHeaders());
        // if data is valid
        clearTimeout(xhrTimeout);
        if (RequestObject.status == 200) {
            // cambios 07/03/2008
            // clearTimeout(xhrTimeout);
            // getting the response
            var msgs = RequestObject.responseText.split('|');
            // alert(RequestObject.responseText);
            document.getElementById("online").innerHTML = msgs[0];
            // document.formaconsulta.boton.disabled=false;

        } else {
            // alert('Status ' + RequestObject.status);
            var msgs = RequestObject.responseText.split('|');
            // alert(RequestObject.responseText);
            document.getElementById("online").innerHTML = msgs[0];
            // Tell the reader that there was error requesting data
            document.getElementById("online").innerHTML = "<div id='box'><center>No pudo ser procesada su solicitud en este momento, favor intente otro momento</center></div>";
        }

        // document.formaconsulta.boton.disabled=false;
        // no inhabilitar, se necesita para la segunda parte.
        // if(document.formaconsulta.nit){
        // document.formaconsulta.nit.value = '';
        // }
        // document.formaconsulta.periodo.value = '';
        // document.formaconsulta.monto.value = '';
    }

}


function ReqChangeUACI() {
    if (RequestObject.readyState == 4) {
        clearTimeout(xhrTimeout);
        if (RequestObject.status == 200) {
            var msgs = RequestObject.responseText.split('|');
            document.getElementById("online").innerHTML = msgs[0];

        } else {
            var msgs = RequestObject.responseText.split('|');
            document.getElementById("online").innerHTML = msgs[0];
            document.getElementById("online").innerHTML = "<div id='box'><center>No pudo ser procesada su solicitud en este momento, favor intente otro momento</center></div>";
        }
    }
}

function ReqChange4() {
    // alert('Entrando a ReqChange ' + RequestObject.readyState);

    // If data received correctly
    if (RequestObject.readyState == 4) {
        // alert(RequestObject.getAllResponseHeaders());
        // if data is valid
        clearTimeout(xhrTimeout);
        if (RequestObject.status == 200) {
            // cambios 07/03/2008
            // clearTimeout(xhrTimeout);
            // getting the response
            var msgs = RequestObject.responseText.split('|');
            // alert(RequestObject.responseText);
            document.getElementById("online").innerHTML = msgs[0];
            document.getElementById("offline").innerHTML = '';
            // document.formaconsulta.boton.disabled=false;

        } else {
            // alert('Status ' + RequestObject.status);
            var msgs = RequestObject.responseText.split('|');
            // alert(RequestObject.responseText);
            document.getElementById("offline").innerHTML = msgs[0];
            // Tell the reader that there was error requesting data
            document.getElementById("offline").innerHTML = "<div id='box'><center>No pudo ser procesada su solicitud en este momento, favor intente otro momento</center></div>";
        }

        // document.formaconsulta.boton.disabled=false;
        // no inhabilitar, se necesita para la segunda parte.
        // if(document.formaconsulta.nit){
        // document.formaconsulta.nit.value = '';
        // }
        // document.formaconsulta.periodo.value = '';
        // document.formaconsulta.monto.value = '';
    }

}


function ReqChange5() {
    if (RequestObject.readyState == 4) {
        clearTimeout(xhrTimeout);
        if (RequestObject.status == 200) {
            var msgs = RequestObject.responseText.split('|');
            document.getElementById("online").innerHTML = msgs[0];
        } else {
            var msgs = RequestObject.responseText.split('|');
            document.getElementById("online").innerHTML = msgs[0];
            document.getElementById("online").innerHTML = "<div id='box'><center>No pudo ser procesada su solicitud en este momento, favor intente otro momento</center></div>";
        }
    }

}

// Inician Cambios 07/03/2008

function ajaxTimeout() {
    RequestObject.abort();
    // alert("Well dang, the AJAX request timed out. Did you lose network
    // "+"connectivity for some reason?");
    document.getElementById("online").innerHTML = "<div id='box'><center>No pudo ser procesada su solicitud, favor intente otro momento.</center></div>";
    document.formaconsulta.boton.disabled = false;
    document.formaconsulta.boton.focus();
    // Note that at this point you could try to send a notification to the
    // server that things failed, using the same xhr object.
}

function ajaxTimeoutOffline() {
    RequestObject.abort();
    // alert("Well dang, the AJAX request timed out. Did you lose network
    // "+"connectivity for some reason?");
    document.getElementById("online").innerHTML = "<div id='box'><center>No pudo ser procesada su solicitud, favor intente otro momento.</center></div>";
    document.formaconsulta.boton.disabled = false;
    document.formaconsulta.boton.focus();
    // Note that at this point you could try to send a notification to the
    // server that things failed, using the same xhr object.
}

// Fin de Cambios 07/03/2008
/*
 * Main AJAX RSS reader request
 */



function AJAXRequestK() {
    if (validarPeriodoK()) {
        document.getElementById("online").innerHTML = "<CENTER><IMG src=images/loading.gif> <BR><FONT color=\"#136DB9\"> Espere un momento mientras procesamos su solicitud</FONT></CENTER> ";
        //document.formaconsulta.boton.disabled = true;
        RequestObject.open("POST", Backend, true);
        xhrTimeout = setTimeout("ajaxTimeout();", 10000);
        RequestObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
        RequestObject.send(createQuery(document.getElementById("formaconsulta")));
        RequestObject.onreadystatechange = ReqChange;
    }
}

function AJAXRequest2() {
        document.getElementById("online").innerHTML = "<CENTER><IMG src=images/loading.gif> <BR><FONT color=\"#136DB9\"> Espere un momento mientras procesamos su solicitud</FONT></CENTER> ";
    document.formaconsulta.boton.disabled = true;
    RequestObject.open("POST", Backend2, true);
    xhrTimeout = setTimeout("ajaxTimeout();", 30000);
    RequestObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
    RequestObject.send(createQuery(document.getElementById("formaconsulta")));
    RequestObject.onreadystatechange = ReqChange2;
}

function AJAXRequest3() {
    if (validarNit()) {
        document.getElementById("online").innerHTML = "<CENTER><IMG src=images/loading.gif> <BR><FONT color=\"#136DB9\"> Espere un momento mientras procesamos su solicitud</FONT></CENTER> ";
        document.formaconsulta.boton.disabled = true;
        //alert(Backend3);
        RequestObject.open("POST", Backend3, true);
        xhrTimeout = setTimeout("ajaxTimeout();", 100000);
        RequestObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
        RequestObject.send(createQuery(document.getElementById("formaconsulta")));
        RequestObject.onreadystatechange = ReqChange3;
    }
}


function AJAXRequestUACI() {
    document.getElementById("online").innerHTML = "<CENTER><IMG src=../../images/loading.gif> <BR><FONT color=\"#136DB9\"> Espere un momento mientras procesamos su solicitud</FONT></CENTER> ";
    document.formaconsulta.boton.disabled = true;
    RequestObject.open("POST", BackendUACI, true);
    xhrTimeout = setTimeout("ajaxTimeout();", 100000);
    RequestObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
    RequestObject.send(createQuery(document.getElementById("formaconsulta")));
    RequestObject.onreadystatechange = ReqChangeUACI;
}

function AJAXRequest4() {

    if (validarNit()) {


        document.getElementById("offline").innerHTML = "<CENTER><IMG src=images/loading.gif> <BR><FONT color=\"#136DB9\"> Espere un momento mientras procesamos su solicitud</FONT></CENTER> ";

        document.formaconsulta.boton.disabled = true;
        document.getElementById("hidEnviar").disabled = true;

        RequestObject.open("POST", Backend4, true);
        xhrTimeout = setTimeout("ajaxTimeoutOffline();", 100000);
        // alert('Luego del open');
        // xhrTimeout=setTimeout("ajaxTimeout();",8000);
        RequestObject.setRequestHeader("Content-Type",
                "application/x-www-form-urlencoded;charset=UTF-8");
        RequestObject.send("nit=" + document.getElementById("nit").value
                + "&email=" + document.getElementById("email").value);

        RequestObject.onreadystatechange = ReqChange4;

    }

}


function AJAXRequest5() {
    if (validarNit()) {
        document.getElementById("online").innerHTML = "<CENTER><IMG src=images/loading.gif> <BR><FONT color=\"#136DB9\"> Espere un momento mientras procesamos su solicitud</FONT></CENTER> ";        
        //document.formaconsulta.boton.disabled = true;
        RequestObject.open("POST", Backend5, true);
        xhrTimeout = setTimeout("ajaxTimeout();", 100000);
        RequestObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
        RequestObject.send(createQuery(document.getElementById("formaconsulta")));
        RequestObject.onreadystatechange = ReqChange3;

    }
}

function createQuery(form) {
    var elements = form.elements;
    var pairs = new Array();
    //alert(form);

    for (var i = 0; i < elements.length; i++) {
        pairs.push(elements[i].name + "="
                + encodeURIComponent(elements[i].value));
        // alert(elements[i].value);
        if ((name = elements[i].name) && (value = elements[i].value)) {
            // pairs.push(name + "=" + encodeURIComponent(value));
            // alert(elements[i].name);

        }

    }
    // alert(pairs.join("&"));
    return pairs.join("&");
}

/*
 * Timer
 */
function update_timer() {
    // alert('entro aqui al updatetimer');
    AJAXRequest();
}



function validarPeriodoK() {
    var p = document.formaconsulta.periodo.value;
    if (p.length <= 3 || p.length > 4) {
        alert("El Periodo Fiscal a consultar debe estar formado por cuatro digitos numericos");
        document.formaconsulta.periodo.focus();
        return false;
    }
    /*
     * Aqui se hara el cambio para que se agregue la consulta de renta 2010
     */

    var today = new Date();
    var year = today.getFullYear();

    if (p > year - 1) {
        alert("El Periodo Fiscal a consultar no puede ser mayor de "
                + (year - 1));
        document.formaconsulta.periodo.focus();
        return false;
    }

    if (p < 2003) {
        alert("El Periodo Fiscal a consultar debe ser mayor o igual a 2003");
        document.formaconsulta.periodo.focus();
        return false;
    }

    if (document.formaconsulta.nit) {
        var n = document.formaconsulta.nit.value;

        if (n.length <= 13 || n.length > 14) {
            alert("El NIT a consultar debe estar formado por catorce digitos numericos");
            document.formaconsulta.nit.focus();
            return false;
        }

        if (!isNumber(n)) {
            alert("Por favor ingrese solo numeros para el NIT");
            document.formaconsulta.nit.focus();
            return false;
        }
    }
    if (!isNumber(p)) {
        alert("Por favor ingrese solo numeros para el Periodo Fiscal");
        document.formaconsulta.periodo.focus();
        return false;
    }

    return true;
}

function isNumber(s) {
    var r = true;
    var v = "0123456789";

    for (var i = 0; i < s.length; i++) {
        var n = s.charAt(i);
        if (v.indexOf(n) != -1)
            continue;
        else {
            r = false;
            break;
        }

    }

    return r;
}

function validarNit() {
    var nit = document.formaconsulta.nit.value;
    if (nit) {
        var n = nit;

        if (n.length <= 13 || n.length > 14) {
            alert("El NIT a consultar debe estar formado por catorce digitos numericos");
            // document.formaconsulta.nit.focus();
            reloadImg('img');
            return false;
        }

        if (!isNumber(n)) {
            alert("Por favor ingrese solo numeros para el NIT");
            // document.formaconsulta.nit.focus();
            reloadImg('img');
            return false;
        }
        return true;
    }
}

function procesaUsoSolvencia() {

    if (document.getElementById("tipoSolv43").checked == true) {

        // document.getElementById("cantidadSolv43").value = 0;
        document.getElementById("cantidadSolv43").readOnly = false;

        document.getElementById("tipoSolv45").checked = false;
        document.getElementById("cantidadSolv45").value = 0;
        document.getElementById("cantidadSolv45").readOnly = true;

        document.getElementById("tipoSolv46").checked = false;
        document.getElementById("cantidadSolv46").value = 0;
        document.getElementById("cantidadSolv46").readOnly = true;

        document.getElementById("tipoSolv47").checked = false;
        document.getElementById("cantidadSolv47").value = 0;
        document.getElementById("cantidadSolv47").readOnly = true;

        document.getElementById("tipoSolv48").checked = false;
        document.getElementById("cantidadSolv48").value = 0;
        document.getElementById("cantidadSolv48").readOnly = true;

    } else {
        document.getElementById("cantidadSolv43").value = 0;
    }

    if (document.getElementById("tipoSolv44").checked == true) {
        document.getElementById("cantidadSolv44").value = 1;
        document.getElementById("cantidadSolv44").readOnly = true;
        document.getElementById("tipoSolv45").checked = false;
        document.getElementById("cantidadSolv45").value = 0;
        document.getElementById("cantidadSolv45").readOnly = true;

        document.getElementById("tipoSolv46").checked = false;
        document.getElementById("cantidadSolv46").value = 0;
        document.getElementById("cantidadSolv46").readOnly = true;

        document.getElementById("tipoSolv47").checked = false;
        document.getElementById("cantidadSolv47").value = 0;
        document.getElementById("cantidadSolv47").readOnly = true;

        document.getElementById("tipoSolv48").checked = false;
        document.getElementById("cantidadSolv48").value = 0;
        document.getElementById("cantidadSolv48").readOnly = true;

    } else {
        document.getElementById("cantidadSolv44").value = 0;
        document.getElementById("cantidadSolv44").readOnly = true;
    }

    if (document.getElementById("tipoSolv45").checked == true) {
        document.getElementById("cantidadSolv45").value = 1;
        document.getElementById("cantidadSolv45").readOnly = true;

        document.getElementById("tipoSolv43").checked = false;
        document.getElementById("cantidadSolv43").value = 0;
        document.getElementById("cantidadSolv43").readOnly = true;

        document.getElementById("tipoSolv44").checked = false;
        document.getElementById("cantidadSolv44").value = 0;
        document.getElementById("cantidadSolv44").readOnly = true;

        document.getElementById("tipoSolv46").checked = false;
        document.getElementById("cantidadSolv46").value = 0;
        document.getElementById("cantidadSolv46").readOnly = true;

        document.getElementById("tipoSolv47").checked = false;
        document.getElementById("cantidadSolv47").value = 0;
        document.getElementById("cantidadSolv47").readOnly = true;

        document.getElementById("tipoSolv48").checked = false;
        document.getElementById("cantidadSolv48").value = 0;
        document.getElementById("cantidadSolv48").readOnly = true;

    } else {
        document.getElementById("cantidadSolv45").value = 0;
        document.getElementById("cantidadSolv45").readOnly = true;
    }

    if (document.getElementById("tipoSolv46").checked == true) {
        document.getElementById("cantidadSolv46").value = 1;
        document.getElementById("cantidadSolv46").readOnly = true;

        document.getElementById("tipoSolv43").checked = false;
        document.getElementById("cantidadSolv43").value = 0;
        document.getElementById("cantidadSolv43").readOnly = true;

        document.getElementById("tipoSolv44").checked = false;
        document.getElementById("cantidadSolv44").value = 0;
        document.getElementById("cantidadSolv44").readOnly = true;

        document.getElementById("tipoSolv45").checked = false;
        document.getElementById("cantidadSolv45").value = 0;
        document.getElementById("cantidadSolv45").readOnly = true;

        document.getElementById("tipoSolv47").checked = false;
        document.getElementById("cantidadSolv47").value = 0;
        document.getElementById("cantidadSolv47").readOnly = true;

        document.getElementById("tipoSolv48").checked = false;
        document.getElementById("cantidadSolv48").value = 0;
        document.getElementById("cantidadSolv48").readOnly = true;

    } else {
        document.getElementById("cantidadSolv46").value = 0;
        document.getElementById("cantidadSolv46").readOnly = true;
    }

    if (document.getElementById("tipoSolv47").checked == true) {
        document.getElementById("cantidadSolv47").value = 1;
        document.getElementById("cantidadSolv47").readOnly = true;

        document.getElementById("tipoSolv43").checked = false;
        document.getElementById("cantidadSolv43").value = 0;
        document.getElementById("cantidadSolv43").readOnly = true;

        document.getElementById("tipoSolv44").checked = false;
        document.getElementById("cantidadSolv44").value = 0;
        document.getElementById("cantidadSolv44").readOnly = true;

        document.getElementById("tipoSolv45").checked = false;
        document.getElementById("cantidadSolv45").value = 0;
        document.getElementById("cantidadSolv45").readOnly = true;

        document.getElementById("tipoSolv46").checked = false;
        document.getElementById("cantidadSolv46").value = 0;
        document.getElementById("cantidadSolv46").readOnly = true;

        document.getElementById("tipoSolv48").checked = false;
        document.getElementById("cantidadSolv48").value = 0;
        document.getElementById("cantidadSolv48").readOnly = true;

    } else {
        document.getElementById("cantidadSolv47").value = 0;
        document.getElementById("cantidadSolv47").readOnly = true;
    }

    if (document.getElementById("tipoSolv48").checked == true) {
        document.getElementById("cantidadSolv48").value = 1;
        document.getElementById("cantidadSolv48").readOnly = true;

        document.getElementById("tipoSolv43").checked = false;
        document.getElementById("cantidadSolv43").value = 0;
        document.getElementById("cantidadSolv43").readOnly = true;

        document.getElementById("tipoSolv44").checked = false;
        document.getElementById("cantidadSolv44").value = 0;
        document.getElementById("cantidadSolv44").readOnly = true;

        document.getElementById("tipoSolv45").checked = false;
        document.getElementById("cantidadSolv45").value = 0;
        document.getElementById("cantidadSolv45").readOnly = true;

        document.getElementById("tipoSolv46").checked = false;
        document.getElementById("cantidadSolv46").value = 0;
        document.getElementById("cantidadSolv46").readOnly = true;

        document.getElementById("tipoSolv47").checked = false;
        document.getElementById("cantidadSolv47").value = 0;
        document.getElementById("cantidadSolv47").readOnly = true;

    } else {
        document.getElementById("cantidadSolv48").value = 0;
        document.getElementById("cantidadSolv48").readOnly = true;
    }

    return;
}